package com.fixme4trade.business;

import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import org.slf4j.Logger;
import br.gov.frameworkdemoiselle.message.MessageContext;
import br.gov.frameworkdemoiselle.stereotype.BusinessController;
import br.gov.frameworkdemoiselle.template.DelegateCrud;

import com.fixme4trade.domain.Customer;
import com.fixme4trade.domain.User;
import com.fixme4trade.persistence.CustomerDAO;

@BusinessController
@ApplicationScoped
public class CustomerBC extends DelegateCrud<Customer, Long, CustomerDAO> {
	
	private static final long serialVersionUID = 1L;
	
	@Inject
	private Logger logger;
	
	@Inject
    private MessageContext messageContext;
	
	@Override
	public void insert(Customer c) {
		super.insert(c);
	}

	@Override
	public void update(Customer c) {
		super.update(c);
	}

	@Override
	public void delete(Long id) {
		super.delete(id);
	}

	public Customer getCustomerByUser(User user) {
		return (user != null)? this.load(user.getUserId()) : null;
	}
}
